<template>
    <el-row>
        <el-col :span="8">
            <el-card class="box-card">
                <el-form :model="queryParams" ref="queryForm" size="small" v-show="showSearch" label-width="68px">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="客户类型" prop="customerType">
                                <el-select v-model="queryParams.customerType" filterable placeholder="请选择"
                                    style="width: 100%">
                                    <el-option v-for="dict in dict.type.customer_type" :key="dict.value" :label="dict.label"
                                        :value="dict.value" />
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="客户名称" prop="customerName">
                                <el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable
                                    style="width: 100%" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="身份证号" prop="idNumber">
                                <el-input v-model="queryParams.idNumber" placeholder="请输入身份证号" clearable
                                    style="width: 100%" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="客户编号" prop="customerCode">
                                <el-input v-model="queryParams.customerCode" placeholder="请输入客户编号" clearable
                                    style="width: 100%" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="开户时间" prop="openDate">
                                <el-date-picker type="date" placeholder="选择开户时间" v-model="queryParams.openDate"
                                    style="width: 100%" value-format="yyyy-MM-dd"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="手机号" prop="telephone">
                                <el-input v-model="queryParams.telephone" placeholder="请输入手机号" clearable
                                    style="width: 100%" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item style="text-align: right;">
                                <el-button type="primary" icon="el-icon-search" size="mini"
                                    @click="handleQuery">搜索</el-button>
                                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                            </el-form-item></el-col>
                    </el-row>
                </el-form>

                <el-table v-loading="loading" :data="userList" border @row-click="tableClick">
                    <el-table-column type="selection" width="50" align="center" />
                    <el-table-column label="客户名称" align="center" key="customerName" prop="customerName"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="客户编号" align="center" key="customerCode" prop="customerCode"
                        :show-overflow-tooltip="true" />
                    <el-table-column prop="customerType" label="客户类型" width="80">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.customer_type" :value="scope.row.customerType" />
                        </template>
                    </el-table-column>
                    <el-table-column label="证件号" align="center" key="idNumber" prop="idNumber" :show-overflow-tooltip="true"
                        width="100" />
                    <el-table-column label="总购气金额" align="center" key="totalAmout" prop="totalAmout"
                        :show-overflow-tooltip="true" width="120" />
                    <el-table-column label="余额" align="center" key="remainAmout" prop="remainAmout"
                        :show-overflow-tooltip="true" width="100" />

                    <el-table-column label="总用气量" align="center" key="totalVolume" prop="totalVolume"
                        :show-overflow-tooltip="true" width="120" />
                    <el-table-column label="剩余气量" align="center" key="remainVolume" prop="remainVolume"
                        :show-overflow-tooltip="true" width="120" />
                    <el-table-column label="计费周期开始时间" align="center" key="cycleStartTime" prop="cycleStartTime"
                        :show-overflow-tooltip="true" width="100" />
                    <el-table-column label="计费周期结束时间" align="center" key="cycleEndTime" prop="cycleEndTime"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="周期内总用气量" align="center" key="cycleUseGas" prop="cycleUseGas"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="周期内总使用金额" align="center" key="cycleUseAmount" prop="cycleUseAmount"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="充值次数" align="center" key="payCount" prop="payCount"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="单元号" align="center" key="unit" prop="unit" :show-overflow-tooltip="true"
                        width="100" />
                    <el-table-column label="楼栋号" align="center" key="building" prop="building"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="楼层号" align="center" key="floor" prop="floor" :show-overflow-tooltip="true" />
                    <el-table-column label="门牌号" align="center" key="houseNo" prop="houseNo"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="客户地址" align="center" key="customerAddress" prop="customerAddress"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="联系电话" align="center" key="telephone" prop="telephone"
                        :show-overflow-tooltip="true" width="120" />
                    <el-table-column label="账单日" align="center" key="billDay" prop="billDay" :show-overflow-tooltip="true"
                        width="120" />
                    <el-table-column label="开户日期" align="center" key="openDate" prop="openDate"
                        :show-overflow-tooltip="true" />
                    <el-table-column label="自动发送短信" align="center" key="isAutoSendmsg" prop="isAutoSendmsg"
                        :show-overflow-tooltip="true" width="120">
                        <template slot-scope="scope">
                            <span v-if="scope.row.isAutoSendmsg == 'N'">否</span>
                            <span v-if="scope.row.isAutoSendmsg == 'Y'">是</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="是否欠费关阀" align="center" key="isCloseOverdue" prop="isCloseOverdue"
                        :show-overflow-tooltip="true" width="120">
                        <template slot-scope="scope">
                            <span v-if="scope.row.isCloseOverdue == 'N'">否</span>
                            <span v-if="scope.row.isCloseOverdue == 'Y'">是</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="是否缴费开阀" align="center" key="isOpenPaid" prop="isOpenPaid"
                        :show-overflow-tooltip="true" width="100">
                        <template slot-scope="scope">
                            <span v-if="scope.row.isOpenPaid == 'N'">否</span>
                            <span v-if="scope.row.isOpenPaid == 'Y'">是</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="短信提醒号码" align="center" key="messagePhone" prop="messagePhone"
                        :show-overflow-tooltip="true" width="120" />

                    <!-- <el-table-column label="充值次数" align="center" key="payCount" prop="payCount" :show-overflow-tooltip="true" /> -->


                    <el-table-column label="备注" align="center" key="remark" prop="remark" :show-overflow-tooltip="true" />
                </el-table>

                <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                    :limit.sync="queryParams.pageSize" @pagination="getList" />
            </el-card>
        </el-col>
        <el-col :span="16">
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>换表登记信息</span>
                </div>
                <el-descriptions class="margin-top" :column="3" :size="size" border>
                    <el-descriptions-item>
                        <template slot="label">
                            客户名称
                        </template>
                        {{ formArr.customerName }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            客户类型
                        </template>
                        <template>
                            <dict-tag :options="dict.type.customer_type" :value="formArr.customerType" />
                        </template>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            地址
                        </template>
                        {{ formArr.customerAddress }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            电话
                        </template>
                        {{ formArr.telephone }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            开户日期
                        </template>
                        {{ formArr.openDate }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            旧表余额
                        </template>
                        {{ formArr.oldRemainAmount }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            旧表号
                        </template>
                        {{ formArr.oldMeterCode }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            旧卡号
                        </template>
                        {{ formArr.oldCardNumber }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            旧表厂家
                        </template>
                        {{ formArr.oldManufacturer }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            旧表类型
                        </template>
                        {{ formArr.oldMeterType }}
                    </el-descriptions-item>
                    <!-- <el-descriptions-item>
                        <template slot="label">
                            营业点
                        </template>
                        {{ formArr.deptId }}
                    </el-descriptions-item> -->

                    <el-descriptions-item>
                        <template slot="label">
                            补气量
                        </template>
                        <el-input v-model="formArr.supplementGasVolume" @blur='supplementingBlur' placeholder="请输入补气量"
                            clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            补气金额
                        </template>
                        <el-input v-model="formArr.supplementAmount" placeholder="请输入补气金额" disabled clearable
                            style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            超用气量
                        </template>
                        <el-input v-model="formArr.beyondVolume" placeholder="请输入超用气量" @blur='purchasingBlur' clearable
                            style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            超用金额
                        </template>
                        <el-input v-model="formArr.beyondAmount" placeholder="请输入超用金额" disabled clearable
                            style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <span class="xinghao">*</span>换表日期
                        </template>
                        <el-date-picker type="date" placeholder="选择换表日期" v-model="formArr.changeDate" style="width: 200px"
                            value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
                    </el-descriptions-item>

                    <el-descriptions-item>
                        <template slot="label">
                            <span class="xinghao">*</span>新表号
                        </template>
                        <el-input v-model="formArr.newMeterCode" placeholder="请输入新表号" clearable style="width: 200px" />
                    </el-descriptions-item>

                    <el-descriptions-item>
                        <template slot="label">
                            新卡号
                        </template>
                        <el-input v-model="formArr.newCardNumber" placeholder="请输入新卡号" clearable style="width: 200px" />
                    </el-descriptions-item>
<!--                    <el-descriptions-item>-->
<!--                        <template slot="label">-->
<!--                            旧表底数-->
<!--                        </template>-->
<!--                        {{ formArr.oldBaseNumber }}-->
<!--                    </el-descriptions-item>-->
<!--                    <el-descriptions-item>-->
<!--                        <template slot="label">-->
<!--                            新表底数-->
<!--                        </template>-->
<!--                        {{ formArr.oldBaseNumber }}-->
<!--                    </el-descriptions-item>-->
                    <el-descriptions-item>
                        <template slot="label">
                            <span class="xinghao">*</span>新表厂家
                        </template>
                        <el-select v-model="formArr.newMeterManufacturer" filterable placeholder="请选择"
                            @change="getMeterListBySupplier" style="width: 200px">
                            <el-option :label="item.supplierName" :value="item.id" v-for="(item, index) in supplierList"
                                :key="index">
                            </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            <span class="xinghao">*</span>新表类型
                        </template>
                        <el-select v-model="formArr.newMeterType" filterable placeholder="请选择" style="width: 200px">
                            <el-option :label="item.typeName" :value="item.id" v-for="(item, index) in meterBySupplierList"
                                :key="index">
                            </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>换表操作类型
                        </template>
                        <el-select v-model="formArr.changeType" filterable placeholder="请选择" style="width: 200px">
                            <el-option v-for="dict in dict.type.change_meter_type" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            支付类型
                        </template>
                        <el-select v-model="formArr.paymentType" filterable placeholder="请选择" style="width:200px">
                            <el-option label="现金" value="1"> </el-option>
                            <el-option label="微信" value="2"> </el-option>
                        </el-select>
                    </el-descriptions-item>

                    <el-descriptions-item>
                        <template slot="label">
                            换表费
                        </template>
                        <el-input v-model="formArr.changeMeterFee" placeholder="请输入换表费" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>换表原因
                        </template>
                        <el-input v-model="formArr.changeReason" placeholder="请输入换表原因" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            新表进气方向
                        </template>
                        <el-radio-group v-model="formArr.newIntakeDirection">
                            <el-radio label="L">左进</el-radio>
                            <el-radio label="R">右进</el-radio>
                        </el-radio-group>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            报警额度
                        </template>
                        <el-input v-model="formArr.newAlarmGas" placeholder="请输入报警额度" clearable style="width: 200px" />
                    </el-descriptions-item> <el-descriptions-item>
                        <template slot="label">
                            DTU编号
                        </template>
                        <el-input v-model="formArr.newDtuCode" placeholder="请输入DTU编号" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            流量计厂家
                        </template>
                        <el-input v-model="formArr.newFlowmeterManufacturer" placeholder="请输入流量计厂家" clearable
                            style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>计价方案
                        </template>
                        <el-select v-model="formArr.newPriceSchemeId" filterable placeholder="请选择" style="width: 200px">
                            <el-option :label="item.schemeName" :value="item.id" v-for="(item, index) in schemeList"
                                :key="index">
                            </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            新表ICCID
                        </template>
                        <el-input v-model="formArr.newIccid" placeholder="请输入新表ICCID" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            新表IMEI
                        </template>
                        <el-input v-model="formArr.newImei" placeholder="请输入新表IMEI" clearable style="width: 200px" />
                    </el-descriptions-item> <el-descriptions-item>
                        <template slot="label">
                            流量计起始量
                        </template>
                        <el-input v-model="formArr.newInitialGas" placeholder="请输入流量计起始量" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>是否带流量计
                        </template>
                        <el-select v-model="formArr.newIsFlowmeter" filterable placeholder="请选择" style="width: 200px">
                            <el-option label="否" value="N"> </el-option>
                            <el-option label="是" value="Y"> </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            是否带GPRS
                        </template>
                        <el-select v-model="formArr.newIsGprs" filterable placeholder="请选择" style="width: 200px">
                            <el-option label="否" value="N"> </el-option>
                            <el-option label="是" value="Y"> </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            通讯地址
                        </template>
                        <el-input v-model="formArr.newMailAddress" placeholder="请输入通讯地址" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            通讯协议
                        </template>
                        <el-input v-model="formArr.newMailProtocol" placeholder="请输入通讯协议" clearable style="width: 200px" />
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>表计状态
                        </template>
                        <el-select v-model="formArr.newMeterStatus" filterable placeholder="请选择" style="width: 200px">
                            <el-option label="待安装" :value="1"> </el-option>
                            <el-option label="已安装" :value="2"> </el-option>
                            <el-option label="已拆卸" :value="3"> </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>支持卡
                        </template>
                        <el-select v-model="formArr.newSupportCard" filterable placeholder="请选择" style="width: 200px">
                            <el-option label="不支持" :value="0"> </el-option>
                            <el-option label="IC卡" :value="1"> </el-option>
                            <el-option label="NFC卡" :value="2"> </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>支持网络
                        </template>
                        <el-select v-model="formArr.newSupportNet" filterable placeholder="请选择" style="width: 200px">
                            <el-option label="不支持" :value="0"> </el-option>
                            <el-option label="支持" :value="1"> </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                          <span class="xinghao">*</span>阀门状态
                        </template>
                        <el-select v-model="formArr.newValveStatus" filterable placeholder="请选择" style="width: 200px">
                            <el-option label="关闭" :value="0"> </el-option>
                            <el-option label="开启" :value="1"> </el-option>
                            <el-option label="未知" :value="2"> </el-option>
                        </el-select>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            单价
                        </template>
                        <el-input v-model="formArr.price" placeholder="请输入单价" clearable style="width: 200px" />
                    </el-descriptions-item>
                  <el-descriptions-item>
                    <template slot="label">
                      备注
                    </template>
                    <el-input v-model="formArr.remark" placeholder="请输入备注" clearable style="width: 200px" />
                  </el-descriptions-item>
                </el-descriptions>
            </el-card>
            <!-- <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>客户类型</span>
                </div>
                <el-descriptions class="margin-top" :column="3" :size="size" border>
                    <el-descriptions-item>
                        <template slot="label">
                            购买方式
                        </template>
                        <span v-if="formArr.buyType == 1">按气量购买</span>
                        <span v-if="formArr.buyType == 2">按金额购买</span>
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            购买金额
                        </template>
                        {{ formArr.paidAmount }}
                    </el-descriptions-item>
                </el-descriptions>
            </el-card> -->
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>图片上传</span>
                </div>
                <el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview" :on-remove="handleRemove"
                    :before-remove="beforeRemove" multiple :limit="3" :on-exceed="handleExceed"
                    :on-success="handleUploadSuccess" :file-list="fileList"  list-type="picture">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
                </el-upload>
            </el-card>
            <div style="width: 100%;text-align: center;margin-top: 20px;">
                <el-button type="primary" @click="submitForm">提交</el-button>
            </div>
        </el-col>
    </el-row>
</template>
<script>
import { changemeterList, changemeterInfo, addChangemeter, volumnToGasPrice } from "@/api/fileManagement/changeMeter.js"
import { customerBindingMeterList } from '@/api/fileManagement/civilArchives.js'
import { getGasmeterList } from '@/api/systemSetup/gasMeter.js'
import { getSupplierList } from "@/api/system/supplierInfo.js"
import { planSelectList } from "@/api/service/planlist.js";
export default {
    dicts: ['change_meter_type', 'customer_type'],
    data() {
        return {
            userId: '',
            loading: false,
            fileUrl: process.env.VUE_APP_BASE_API + "/upload",
            schemeList: [],
            supplierList: [],
            meterBySupplierList: [],
            userList: [],
            size: 'mini',
            // 显示搜索条件
            showSearch: true,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                customerType: null,
                customerName: null,
                idNumber: null,
                deptId: null,
                openDate: null,
                telephone: null,
                customerCode: null,
                meterId: null,
            },
            total: 0,
            formArr: {
                address: '',
                attachment: '',
                beyondGasAmount: '',
                beyondGasVolume: '',
                buyType: '',
                changeDate: '',
                changeMeterFee: "",
                changeReason: '',
                changeType: '',
                createTime: '',
                customerName: '',
                gasVolumn: '',
                intakeDirection: '',
                isPurchase: '',
                newAlarmGas: '',
                newBaseNumber: '',
                newCardNumber: '',
                newDtuCode: '',
                newFlowmeterManufacturer: '',
                newIccid: '',
                newImei: '',
                newInitialGas: '',
                newInstallTime: '',
                newIsFlowmeter: '',
                newIsGprs: '',
                newMailAddress: '',
                newMailProtocol: '',
                newMeterBrand: '',
                newMeterCode: '',
                newMeterManufacturer: '',
                newMeterModel: '',
                newMeterPhoneNum: '',
                newMeterStatus: '',
                newMeterType: '',
                newSupportCard: '',
                newPriceSchemeId: '',
                newSupportNet: '',
                oldBaseNumber: '',
                oldCardNumber: '',
                oldMeterBrand: '',
                oldMeterCode: "",
                oldManufacturer: '',
                oldMeterType: '',
                openDate: '',
                paidAmount: '',
                paymentType: '',
                price: '',
                remark: '',
                stationId: '',
                supplementGasAmount: '',
                supplementGasVolume: '',
                telephone: '',
                newIntakeDirection:'L',
                newValveStatus:''
            },
            fileList: [],
            imageUrl:'',

        }
    },
    created() {
        // this.getList();
        this.getsupplierList()
        this.getPricingPlanList()
    },
    methods: {
        //补气量转化
        supplementingBlur() {
            let parm = {
                customerId: this.userId,
                payVolumn: this.formArr.supplementGasVolume
            }
            volumnToGasPrice(parm).then((res) => {
                if (res.code == 200) {
                    this.$set(this.formArr, 'supplementAmount', res.data)
                }
            })
            console.log(this.formArr.supplementGasVolume)

        },
        // 超用量转化
        purchasingBlur() {
            let parm = {
                customerId: this.userId,
                payVolumn: this.formArr.supplementGasVolume
            }
            volumnToGasPrice(parm).then((res) => {
                if (res.code == 200) {
                    this.$set(this.formArr, 'beyondAmount', res.data)
                }
            })
            console.log(this.formArr.beyondVolume)
        },
        // 上传成功回调
        handleUploadSuccess(res, file) {
            if (res.code === 200) {
                this.$set(this.formArr, 'attachment', res.imgUrl)
                this.imageUrl  = res.imgUrl
            }
        },
        // 查询计价方案
        getPricingPlanList() {
            planSelectList().then((res) => {
                this.schemeList = res
            })
        },
        /** 查询供应商列表 */
        getsupplierList() {
            getSupplierList().then((response) => {
                this.supplierList = response.data;

            });
        },
        // 供应商选择后获取表计类型
        getMeterListBySupplier() {
            getGasmeterList({ manufacturerId: this.formArr.newMeterManufacturer }).then((res) => {
                this.meterBySupplierList = res.data
            })
        },
        // 新增提交
        submitForm() {

            if(this.formArr.changeDate == undefined||this.formArr.changeDate ==''){
                this.$message.warning('请填写换表日期')
                return
            }
            if(this.formArr.newMeterCode == undefined || this.formArr.newMeterCode ==''){
                this.$message.warning('请填写新表号')
                return
            }
            if(this.formArr.newMeterManufacturer == undefined ||this.formArr.newMeterManufacturer ==''){
                this.$message.warning('请选择新表厂家')
                return
            }
            if(this.formArr.newMeterType == undefined || this.formArr.newMeterType ==''){
                this.$message.warning('请选择新表类型')
                return
            }

            if(this.formArr.changeType == undefined || this.formArr.changeType ==''){
                this.$message.warning('请选择换表操作类型')
                return
            }
            if(this.formArr.changeReason == undefined || this.formArr.changeReason ==''){
                this.$message.warning('请填写换表原因')
                return
            }
            if(this.formArr.newIntakeDirection == undefined || this.formArr.newIntakeDirection ==''){
                this.$message.warning('请填写新表进气方向')
                return
            }

            if(this.formArr.newPriceSchemeId == undefined ||this.formArr.newPriceSchemeId ==''){
                this.$message.warning('请选择计价方案')
                return
            }

            if(this.formArr.newIsFlowmeter == undefined || this.formArr.newIsFlowmeter ==''){
                this.$message.warning('请填写是否带流量计')
                return
            }
            if(this.formArr.newSupportCard == undefined || this.formArr.newSupportCard ==''){
                this.$message.warning('请填写支持卡')
                return
            }
            if(this.formArr.newSupportNet == undefined || this.formArr.newSupportNet ==''){
                this.$message.warning('请填写支持网络')
                return
            }
            if(this.formArr.newMeterStatus == undefined || this.formArr.newMeterStatus ==''){
                this.$message.warning('请填写表计状态')
                return
            }
            if(this.formArr.newValveStatus == undefined || this.formArr.newValveStatus ==''){
                this.$message.warning('请填写阀门状态')
                return
            }

            addChangemeter(this.formArr).then((res) => {
                if (res.code == 200) {
                    this.$modal.msgSuccess("提交成功");
                    this.$emit('closeDialog')
                } else {
                    this.$modal.msgError(res.msg);
                }
            })
        },
        // 点击表格某一行
        tableClick(row) {
            this.userId = row.id
            changemeterInfo(row.id).then((res) => {
                this.formArr = res.data
                this.formArr.newIntakeDirection='L'
            })
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        getList() {
            this.loading = true;
            customerBindingMeterList(this.queryParams).then((response) => {
                this.userList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        handleRemove(file, fileList) {
            console.log(file, fileList);
        },
        handlePreview(file) {
            console.log(file);
        },
        handleExceed(files, fileList) {
            this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
        },
        beforeRemove(file, fileList) {
            return this.$confirm(`确定移除 ${file.name}？`);
        }
    },


}
</script>
<style scoped>
    .xinghao{
        color:red;
    }
    .avatar {
        width: 178px;
        height: 178px;
        display: block;
    }
</style>